package com.hn.sanya.zzht.model;

import java.util.HashMap;
import java.util.Map;

/**
 * 　　* @Description: ${todo}
 * 　  * @author $username$
 *
 * @Method $Method$
 * 　　* @param ${tags}
 * 　　* @return ${return_type}
 * 　　* @date $date$ $time$
 *
 */
public class ResponseStatus {

    private final String message;
    private final int code;
    private final Map<String, Object> data = new HashMap<String, Object>();
    public String getMessage() {
        return message;
    }
    public int getCode() {
        return code;
    }
    public Map<String, Object> getData() {
        return data;
    }
    public ResponseStatus putDataValue(String key, Object value) {
        data.put(key, value);
        return this;
    }
    private ResponseStatus(int code, String message) {
        this.code = code; this.message = message;
    }
    public static ResponseStatus ok() {
        return new ResponseStatus(200, "Ok");
    }
    public static ResponseStatus notFound() {
        return new ResponseStatus(404, "Not Found");
    }
    public static ResponseStatus badRequest() {
        return new ResponseStatus(400, "Bad Request");
    }
    public static ResponseStatus forbidden() {
        return new ResponseStatus(403, "Forbidden");
    }
    public static ResponseStatus unauthorized() {
        return new ResponseStatus(401, "unauthorized");
    }
    public static ResponseStatus serverInternalError() {
        return new ResponseStatus(500, "Server Internal Error");
    }
    public static ResponseStatus customerError() {
        return new ResponseStatus(1001, "customer Error");
    }
    public static ResponseStatus noLogin() {
        return new ResponseStatus(601, "未登录，请重新登录");
    }

}
